<?php
	include_once "dataservice.php";
	
	class binhluan_quanly_db
	{
		public function Them($ChoPhepBinhLuan, $Captcha, $KiemDuyet, $DoDaiToiDa, $SoBinhLuanMoiTrang)
		{
			$sql = "INSERT 
					INTO `tbl_binhluan_quanly`(`ChoPhepBinhLuan`,
													`Captcha`,
												   `KiemDuyet`, 
												   `DoDaiToiDa`, 
												   `SoBinhLuanMoiTrang`) 
					VALUES ('$ChoPhepBinhLuan', '$Captcha', '$KiemDuyet', '$DoDaiToiDa', '$SoBinhLuanMoiTrang')";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function CapNhat($ChoPhepBinhLuan, $Captcha, $KiemDuyet, $DoDaiToiDa, $SoBinhLuanMoiTrang)
		{
			$sql = "UPDATE 	`tbl_binhluan_quanly` 
					SET 	`ChoPhepBinhLuan`    = '$ChoPhepBinhLuan',
							`Captcha`            = '$Captcha',
							`KiemDuyet`          = '$KiemDuyet',
							`DoDaiToiDa`         = '$DoDaiToiDa',
							`SoBinhLuanMoiTrang` = '$SoBinhLuanMoiTrang' 
					WHERE 	1";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function LayDanhSach()
		{
			$sql = "SELECT * FROM `tbl_binhluan_quanly` WHERE 1";
			
			$service = new dataservice();
			return $service->ExecuteQuery($sql);
		}
	}
?>